home *** CD-ROM | disk | FTP | other *** search
/ The X-Philes (2nd Revision) / The X-Philes Number 1 (1995).iso / xphiles / hp48_1 / stack.vie / comp.sys.handhelds_1266_000000.msg
Internet Message Format  |  1995-03-23  |  4KB

  1. Path: en.ecn.purdue.edu!pur-ee!mentor.cc.purdue.edu!purdue!tut.cis.ohio-state.edu!cs.utexas.edu!rutgers!bellcore!texbell!texsun!newstop!sun!imagen!atari!portal!portal!cup.portal.com!Jake-S
  2. From: Jake-S@cup.portal.com (Jake G Schwartz)
  3. Newsgroups: comp.sys.handhelds
  4. Subject: HP48SX Stack View Utility - up to 10 levels
  5. Message-ID: <27510@cup.portal.com>
  6. Date: 3 Mar 90 20:31:42 GMT
  7. References: <719@telesoft.com>
  8. Organization: The Portal System (TM)
  9. Lines: 67
  10.  
  11.  
  12.                      An HP48SX Stack Display Utility
  13.                           For Up To Ten Levels
  14.  
  15.      The HP48SX calculator LCD display contains 64 by 131 pixels and is pro-
  16. moted as being an 8-line display.  However, in very few instances do eight 
  17. lines of information actually appear at any one time. (The Matrix Writer
  18. application mode is one of the exceptions.)  In general, we see two status
  19. lines, four stack lines plus a single menu key line, totalling seven. 
  20. Occasionally, it would be useful to be able to utilize the entire display to
  21. show the stack when there are greater than four levels of depth; and the
  22. extensive graphics capability of the HP48 allows us to do just that.
  23.  
  24.      In graphics mode, we may write text from objects in the stack at any
  25. specified coordinates in the graphics picture and in any of three text
  26. sizes.  Size 3 corresponds to the large 5 by 9 characters which are used in
  27. the normal stack display; size 2 is the familiar 5 by 7 size of the
  28. characters found in the HP28 display and also used to show HP48 error
  29. messages and prompts at the top of the LCD; and size 1 represents the 3 by 5
  30. characters which appear in the line-1 menu labels.  For stacks of 8 levels
  31. or less, stack values in the graphics display may be nicely displayed using
  32. the size-2 characters.  If the stack contains 9 levels or more, size-1
  33. characters will allow up to 10 rows of the stack to be shown at once.
  34.  
  35.      The following stack-view program STKV allows viewing up to ten levels
  36. of the stack simultaneously in the graphics picture.  The original display
  37. mode, plot parameters, RPN stack values and graphics picture are all
  38. preserved.  To run the program, press the STKV key in the VAR menu.  After a
  39. few seconds the stack is displayed up to 10 levels. The system remains
  40. halted until ATTN is pressed, after which the program resumes to restore the
  41. original PPAR and PICT.  Each line of the stack is labelled with its level
  42. number followed by a colon.  These level identifiers are generated inside
  43. the main loop via the CHR function, which converts a character number to the
  44. corresponding string character.  The value 48 becomes a zero, 49 a one, etc. 
  45. As a result, the line 10 identifier (generated by doing 58 CHR in the loop)
  46. turns out to be a colon, but is left alone to save precious execution time.
  47.  
  48.                                             Jake Schwartz
  49.  
  50. Program listing:
  51. ----------------
  52.  
  53. STKV     351 bytes, checksum #D7C2h
  54.  
  55. << PICT RCL PPAR -> pict ppar            ; Save original PICT and PPAR 
  56.    << PICT PURGE                         ; Purge original graphics picture
  57.       1 32 XRNG 1 64 YRNG                ; Set new X and Y ranges for stack
  58.       1 DEPTH 1 - 10 MIN DUP             ; Determine current stack height
  59.       IF 8 >                             ; If greater than 8,text row height
  60.       THEN 6 1                           ;  is 6 and text size is 1  
  61.       ELSE 8 2                           ; Otherwise, text row height is 8
  62.       END -> rowht tsize                 ;  and text size is 2        
  63.       << FOR I PICT 1 I rowht *          ; Loop for the no. of stack levels:
  64.          R->C I 48 + CHR                 ;   Build stack level identifier
  65.          ":" +                           ;   Attach a colon to identifier
  66.          tsize ->GROB GOR                ;   Add identifier to picture
  67.          PICT rowht 2 / I rowht * R->C   ;   Compute coordinates,
  68.          I 2 + PICK                      ;   Get stack value,
  69.          tsize ->GROB GOR                ;   And add to picture
  70.          NEXT                            ; End loop
  71.          { } PVIEW                       ; Turn on GRAPHICS, halt until ATTN
  72.          ppar 'PPAR' STO pict PICT STO   ; Restore original PPAR and picture
  73.       >>
  74.    >>
  75. >>
  76.  
  77.    
  78.